package com.dcloud.core.client;


import com.dcloud.core.client.rdbms.absRdbms.AbsRdbmsClient;
import com.dcloud.core.client.rdbms.absRdbms.AbsRdbmsConnFactory;
import com.dcloud.core.source.ISource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description //mysql客户端
 * @Author shijf
 * @Date 0:16 2022/7/7
 */
@Component("POSTGRES")
@Slf4j
public class PostgresRdbmsClient extends AbsRdbmsClient {

    @Override
    protected AbsRdbmsConnFactory getConnFactory() {
        return new PostgresRdbmsConnFactory();
    }


    @Override
    public List<Map<String,Object>> execQueryWithLimit(ISource defineSource, String taskSql, Long offset, Long rows) {
        String newTaskSql = "select * from ( "+taskSql+" ) a  limit " + rows +" OFFSET " + offset;
        return super.execQuery(defineSource,newTaskSql);
    }
}
